home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Cappuccino / Source / CappuccinoUndo.cpp < prev    next >
Encoding:
Text File  |  1995-12-11  |  2.8 KB  |  117 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        CappuccinoUndo.cpp
  3.     
  4.     Contents:    Implements undo/redo support.
  5.     
  6.     Written by:    Troy Gaul
  7.     
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11. // -- Compiler/Preprocessor Switches --
  12.  
  13. #ifndef _COMPILERDEFS_
  14. #include "CompDefs.h"
  15. #endif
  16.  
  17. // -- OpenDoc Utilities --
  18.  
  19. #ifndef _EXCEPT_
  20. // Exceptions define several important macros (eg. CHECKENV)
  21. // which are used in the SOM method dispatch glue. If Except.h
  22. // is not included early enough, exceptions may not be thrown
  23. // correctly when returning from a SOM method with the "ev" parameter set.
  24. #include <Except.h>
  25. #endif
  26.  
  27. // -- Cappuccino Includes --
  28.  
  29. #ifndef _CAPPUCCINO_
  30. #include "Cappuccino.h"
  31. #endif
  32.  
  33. #ifndef _CAPPUCCINOACTION_
  34. #include "CappuccinoAction.h"
  35. #endif
  36.  
  37. #ifndef _CAPPUCCINODEF_
  38. #include "CappuccinoDef.h"
  39. #endif
  40.  
  41. #ifndef _CAPPUCCINOGLOBALS_
  42. #include "CappuccinoGlobals.h"
  43. #endif
  44.  
  45. // -- OpenDoc Includes --
  46.  
  47. #ifndef _ODTYPES_
  48. #include <ODTypes.h>
  49. #endif
  50.  
  51. // -- OpenDoc Utilities --
  52.  
  53. #ifndef _ODDEBUG_
  54. #include <ODDebug.h>
  55. #endif
  56.  
  57. #ifndef _ODUTILS_
  58. #include <ODUtils.h>
  59. #endif
  60.  
  61. #ifndef _TEMPOBJ_
  62. #include <TempObj.h>
  63. #endif
  64.  
  65. //==============================================================================
  66. #pragma mark    • Undo ODPart overrides •
  67. //==============================================================================
  68.  
  69. //------------------------------------------------------------------------------
  70. // Method:        UndoAction
  71. // Origin:        ODPart
  72. //
  73. // Description:    This method is called when and action needs to be undone.
  74. //------------------------------------------------------------------------------
  75.  
  76. void Cappuccino::UndoAction( Environment*        ev,
  77.                              ODActionData*        actionState )
  78. {
  79.     SOM_Trace("Cappuccino","UndoAction");
  80.     
  81.     CAction::GetActionStateAction(actionState)->HandleUndo(ev);
  82. }
  83.  
  84. //------------------------------------------------------------------------------
  85. // Method:        RedoAction
  86. // Origin:        ODPart
  87. //
  88. // Description:    This method is called when an action needs to be redone.
  89. //------------------------------------------------------------------------------
  90.  
  91. void Cappuccino::RedoAction( Environment*        ev,
  92.                              ODActionData*        actionState )
  93. {
  94.     SOM_Trace("Cappuccino","RedoAction");
  95.  
  96.     CAction::GetActionStateAction(actionState)->HandleRedo(ev);
  97. }
  98.  
  99. //------------------------------------------------------------------------------
  100. // Method:        DisposeActionState
  101. // Origin:        ODPart
  102. //
  103. // Description:    This method is called when we need to dispose of the contents
  104. //                of an ODActionData byte array because the action is not longer
  105. //                needed by OpenDoc.
  106. //------------------------------------------------------------------------------
  107.  
  108. void Cappuccino::DisposeActionState( Environment*        ev,
  109.                                      ODActionData*        actionState,
  110.                                      ODDoneState        doneState)
  111. {
  112.     SOM_Trace("Cappuccino","DisposeActionState");
  113.     
  114.     delete CAction::GetActionStateAction(actionState);
  115. }
  116.  
  117.